package src.consumer_producer;

import java.util.Random;

/**
 * Created by 58 on 2016/3/23.
 */
public class Consumer extends Thread {
    private Table table;
    private final Random random;

    public Consumer(String name,Table table, long seed) {
        super(name);
        this.table = table;
        this.random = new Random(seed);
    }

    @Override
    public void run() {
        try {
            while (true) {
                String cake = table.take();
                System.out.println(cake);
                Thread.sleep(1000L);
            }
        } catch (InterruptedException e) {
        }
    }
}
